' Zoom
' This program uses the illusion of zooming through space
'   to demonstrate the STEP keyword.

CLS

delay% = 800                            ' controls how fast stars "shoot"

PRINT "Press any key to stop"

WHILE INKEY$ = ""
    PSET (245, 148), 30            ' set center (for default Output window)
    quad% = INT(RND(1) * 4)        ' random number for quadrant from
                                   '   which the "star" will shoot
    randX% = INT(RND(1) * 10)   ' random number for column movement
    randY% = INT(RND(1) * 10)   ' random number for row movement

    IF quad% = 0 OR quad% = 1 THEN  ' normal movement is down;
        randY% = -randY%            '   reverse y value to move up
    END IF
    IF quad% = 0 OR quad% = 3 THEN  ' normal movement is to right;
        randX% = -randX%            '   reverse x value to move to left
    END IF
   
    FOR i% = 1 TO 12
        PSET STEP(-randX% * i%, randY% * i%)  ' draw "star"
       
        FOR j% = 1 TO delay%        ' delay loop
        NEXT j%
       
        PRESET STEP(0, 0)           ' erase "star"
    NEXT i%

WEND
